CPP=g++
#CPPFLAGS+=-Wall -g -fpermissive -fopenmp -Wsign-compare -DDEBUG -D_GNU_SOURCE -D__PET_LINUX_BUILD__ -DHAVE_NETINET_IN_H -DFFTW_DOUBLE_ONLY -ggdb -fPIC -std=c++11 -Ofast 
CPPFLAGS+=-fpermissive -Wsign-compare  -Ofast -std=c++11
#CPPFLAGS+= -g -fopenmp -Wsign-compare -DDEBUG -D_GNU_SOURCE -D__PET_LINUX_BUILD__ -DHAVE_NETINET_IN_H -DFFTW_DOUBLE_ONLY -ggdb -fPIC 
INCLUDE+=-I/usr/local/include/ -I./cnn/ -I./cnn/Eigen
MKDEP=gcc -E -MM
LIBINC=-L/usr/local/lib

SRCS= calTwoPoints.cpp ./cnn/cnpy.cpp

DESS = generateFlag.cpp segFlag.demo.cpp segFlag.tmp.cpp selectJpgFromVideo.cpp 

OBJS=$(SRCS:%.cpp=%.o)

EXES=$(DESS:%.cpp=%.bin)

LIBS= -L/usr/local/lib -lopencv_stitching -lopencv_superres -lopencv_videostab -lopencv_photo -lopencv_aruco -lopencv_bgsegm -lopencv_bioinspired -lopencv_ccalib -lopencv_dpm -lopencv_face -lopencv_freetype -lopencv_fuzzy -lopencv_img_hash -lopencv_line_descriptor -lopencv_optflow -lopencv_reg -lopencv_rgbd -lopencv_saliency -lopencv_stereo -lopencv_structured_light -lopencv_phase_unwrapping -lopencv_surface_matching -lopencv_tracking -lopencv_datasets -lopencv_text -lopencv_dnn -lopencv_plot -lopencv_ml -lopencv_xfeatures2d -lopencv_shape -lopencv_video -lopencv_ximgproc -lopencv_calib3d -lopencv_features2d -lopencv_highgui -lopencv_videoio -lopencv_flann -lopencv_xobjdetect -lopencv_imgcodecs -lopencv_objdetect -lopencv_xphoto -lopencv_imgproc -lopencv_core \
-lz


all: $(OBJS) $(EXES)

.cpp.o:
	$(CPP) $(CPPFLAGS) $(INCLUDE) -c $< -o $@

%.bin:	%.cpp $(OBJS) .depend 
	$(CPP) $(CPPFLAGS) $(INCLUDE) $< -o $@ $(LIBINC) $(OBJS) $(LIBS) 


.depend: makefile 
	$(MKDEP) $(INCLUDE) $(SRCS) $(DESS) --std=c++11 > .depend

ifeq (.depend,$(wildcard .depend))
include .depend
endif

clean:
	$(RM) $(OBJS) .depend
	$(RM) $(EXES) .depend

